#ifndef H_CHANNELS_20070217
#define H_CHANNELS_20070217


#include "types.h"
#include "linkedlists.h"


/* channel flags */
#define		CHANMODE_DEFAULT		0x0
#define		CHANMODE_PRIVATE		0x1
#define 		CHANMODE_SECRET		0x2
#define		CHANMODE_INVITONLY	0x4
#define		CHANMODE_MODERATED	0x8
#define		CHANMODE_LIMITED		0x16

#define		CHAN_SETMODE(ch,mode)	(ch->modes |= mode)

#define		CHAN_ISPRIVATE	(ch)			(ch->modes & CHANMODE_PRIVATE)
#define		CHAN_ISSECRET	(ch)			(ch->modes & CHANMODE_SECRET	)
#define		CHAN_ISINVITONLY(ch)			(ch->modes & CHANMODE_INVITONLY)
#define		CHAN_ISMODERATED(ch)		(ch->modes & CHANMODE_MODERATED	)
#define		CHAN_ISLIMITED	(ch)			(ch->modes & CHANMODE_LIMITED	)


int chan_init_hashtable (void);
int chan_compare (void* E1, void* E2);
int chan_gethash (HashTable* htb, void* element);

Channel* chan_new (char name[CHAN_MAXNAMESIZE], char topic[CHAN_MAXTOPICSIZE], uchar modes, ulong owner);
void chan_add (Channel *chan);
void chan_del (const char* channel);
void chan_member_add (Channel* channel, const char* user, int level);
void chan_member_del (Channel* channel, const char* user);
ChannelClient* chan_member_find (Channel *chan, const char* user);

void chan_ban_add (Channel* chan, BlackList* banme);
void chan_ban_del (Channel* chan, const char* user);
BlackList* chan_ban_find (Channel *chan, const char* user);


#endif

